// 管理资源
import request from '@/api/request'

// 查询所有菜单
export function findAllPermissions() {
  return request({
    url: '/admin/sysAuth/permission/findAllPermissions',
    method: 'GET',
  })
}
export function remove(id) {
    return request({
      url: `/admin/sysAuth/permission/remove/${id}`,
      method: 'DELETE',
    })
  }

//   新增菜单权限
export function permission(data) {
    return request({
      url: '/admin/sysAuth/permission/save',
      method: 'POST',
      data
    })
  }
// 初始化菜单权限
  export function saveInitMenus(data) {
    return request({
      url: '/admin/sysAuth/permission/saveInitMenus',
      method: 'POST',
      data
    })
  }

//   给角色分配权限
  export function saveRolePermission(data) {
    return request({
      url: '/admin/sysAuth/permission/saveRolePermission',
      method: 'POST',
      data
    })
  }

//   根据角色获取菜单
export function selectAllMenu(roleId) {
    return request({
      url: `/admin/sysAuth/permission/selectAllMenu/${roleId}`,
      method: 'GET',
    })
  }

  export function update(data) {
    return request({
      url: '/admin/sysAuth/permission/update',
      method: 'PUT',
      data
    })
  }
